/////////
// Repliction syntax for experimental analyses of the paper 
// Vierus & Ziller (2025) - Political support in times of progressive policy change and radical-right populist party success
///////// 

	set more off
	version 17.0
	clear all 
	
//intalling ados
local adolist asdoc coefplot fre markout estout resize 

foreach ado in `adolist' {
    cap which `ado'
    if _rc != 0 {
        di in red "`ado' is not installed. Installing now..."
        ssc install `ado'
    }
    else {
        di in green "`ado' is already installed."
		}
}
	
********************************************************************************	
**# Building Sample & last data preparation
********************************************************************************	
*Setup Working Directory & load data
****
cd "WORKING DIRECTORY"
use  "VZ_experiment_data.dta", clear
	
	
*Preparing variables
****
	
//Dichtomizing
recode populism 1=0 2=. 3/4=1, gen(pop_bin)		//3+4 = 1
recode progressive 1=0 2/3=1	, gen(prog_bin)			//2+3 = 1
				
lab define prog_bin 0 "No progressive policy" 1 "Progressive policy"
lab val prog_bin prog_bin
	
lab define pop_bin 0 "No populism" 1 "Populism"
lab val pop_bin pop_bin 				
	
//Missing Labels
fre progressive populism	
				
lab define progressive 1 "no progressive policy" 2 "progressive policy" 3 "progressive policy + threat", modify
lab val progressive progressive
	
lab define populism 1 "no populism" 2 "opposing policy position" 3 "populist policy position" 4 "populist policy position + rhetoric", modify
lab val populism populism 		
	
//drop 
drop if pop_bin == . 	

//Check meantimes on treatment per group
table (c_0002), stat(mean time_v) stat(p50 time_v) stat(p50 duration)	

//Drop cases with low times on vignettes
gen marker = 0 
replace marker = 1 if (time_v > 0 & time_v < 0.25 & !inlist(c_0002,1))

//Check whether dropouts are equally distributed over experimental groups
reg marker i.c_0002 if !inlist(c_0002,1)	

//Drop cases under 2 minutes overallduration
cap drop marker2
gen marker2 = 0 
replace marker2 = 1 if duration >= 0 & duration <= 2 

//Missing on Outcome variales
mark nonmiss
markout nonmiss sup_pol trust_gov 

//Check exluded cases
gen exclusion = 0 
replace exclusion = 1 if nonmiss == 0 | nuller > 15 | marker2 == 1 | marker == 1
reg exclusion i.c_0002  if !inlist(c_0002,1)

//Check exluded cases due to sociodemographics?
reg exclusion  female age migr lrscale educ income subj_income i.c_0002   if !inlist(c_0002,1)	

//Reducing sample due to data quality
count	//2759
drop if nuller > 15 	//70 due to speeder
drop if nonmiss == 0 	//3 due to missings on outcome
drop if marker2 == 1	//6 due to too overall durations
drop if marker == 1 	//233 due to short time on vignette 
count //2447

//Standardizing variables
foreach var of varlist  support_gov3 support_gov4 sup_pol trust_gov lkh_voting lkh_protest lrscale {
egen std`var'=std(`var')  
}			

//Creating split samples
sum conservation, det
gen cons_high = 1 if conservation > 4 & conservation != . 
	replace cons_high = 0 if conservation <= 4 & conservation !=.
	
sum lrscale, det
gen dummy_right = 1 if lrscale > 6 & lrscale != . 
	replace dummy_right = 0 if lrscale <= 6 & lrscale !=.
	
sum lrscale, det
gen dummy_left = 1 if lrscale < 6 & lrscale != . 
	replace dummy_left = 0 if lrscale >= 6 & lrscale !=.		
	
sum justification, det
gen high_justification = 1 if justification > 3.1 & justification != . 
	replace high_justification = 0 if justification <= 3.1 & justification !=.

sum pol_congruence, det
gen high_cong = 1 if pol_congruence > 2.6 & pol_congruence != . 
	replace high_cong = 0 if pol_congruence <= 2.6 & pol_congruence !=.
		
//Save subdataset for analyses		
compress					
save  "VZ_experiment_data_sample.dta", replace	

			

**# Figure 1 - Direct Effects & Interaction
********************************************************************************	
//Creating helping variables
clonevar prog_bin_int=prog_bin
clonevar pop_bin_int=pop_bin
clonevar topic_int=topic

//Estimating the models
estimates clear
foreach var of varlist  stdsup_pol stdtrust_gov {
	reg `var'  i.prog_bin  i.pop_bin  i.topic
	est sto alle_`var'_t0
	
	reg `var' i.prog_bin_int##i.pop_bin_int i.topic_int
	est sto all_`var'_t1			
}

//Creating Coefplot
coefplot  alle_*_t0 all_*_t1,  bylabel(1 All topics) xline(0) mcolor(navy) ciopts(color(navy)) grid(none)  ///
		  keep(1.pop_bin 1.prog_bin 1.prog_bin_int#1.pop_bin_int *topic) xline(0)	xscale(range(-0.6(0.2)0.3)) xlabel(-0.6(0.2)0.2)  headings(1.prog_bin=`" "{bf: A Policy progressiveness}" "(ref. no progressiveness)" "' 1.pop_bin=`" "{bf:B Populism}" "(ref. no populism mentioned)" "' 2.topic= `" "{bf: C Policy Areas}" "(ref. gender equity)" "' 1.prog_bin_int#1.pop_bin_int=`" "{bf: D Interaction}"  "'   )   coeflabels(1.prog_bin_int#1.pop_bin_int="Progressive policy × populism",labsize(small))  subtitle(, size(small))  p1(label(Support for policy)) p2(label(Trust in government)) legend(position(6) cols(2))  byopts(row(1)) name(ate, replace) 
		
resize ate, xsize(15cm) ysize(12cm)		

graph export "fig1.png", replace
graph save "fig1.gph", replace

			
**# Figure 2 - Conditional Effect plot with Interactions
********************************************************************************
//Estimating the models
estimates clear
reg stdsup_pol i.prog_bin i.pop_bin i.topic
eststo base
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic
eststo base_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if income < 6
eststo Income_low
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if income < 6
eststo Income_low_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if subj_income < 3
eststo Subj_income_low
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if subj_income < 3
eststo Subj_income_low_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if female==0
eststo Male
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if female==0
eststo Male_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if educ==2 | educ==3 | educ==4
eststo Education_low
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if educ==2 | educ==3 | educ==4
eststo Education_low_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if lrscale > 5
eststo Ideology_right
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if lrscale > 5
eststo Ideology_right_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if tradition>4
eststo Traditionalism_high
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if tradition>4
eststo Traditionalism_high_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if age>48
eststo Age_above48
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if age>48
eststo Age_above48_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if justification<3.17
eststo Systemjust_high
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if justification<3.17
eststo Systemjust_high_int

//Creating Coefplot
coefplot Education_low Education_low_int base base_int,  bylabel(1 Low education) xline(0) mcolor(navy) ciopts(color(navy))  ///
|| Subj_income_low Subj_income_low_int base base_int, bylabel(2 Low coping w. income)  ///
|| Income_low Income_low_int base base_int, bylabel(3 Low income)  ///		
|| Male Male_int base base_int, bylabel(4 Male) ///
|| Age_above48 Age_above48_int base base_int, bylabel(5 Age (> median(48))) ///
|| Ideology_right Ideology_right_int base base_int, bylabel(6 Ideology - right)  ///
|| Traditionalism_high Traditionalism_high_int base base_int, bylabel(7 Traditionalism - high)  ///
|| Systemjust_high Systemjust_high_int base base_int, bylabel(8 System Just. - high) ///
 keep(1.pop_bin 1.prog_bin 1.prog_bin_int#1.pop_bin_int) xline(0) 	xscale(range(-0.65(0.2)0.2)) xlabel(-0.6(0.2)0.2) ///
	 legend(position(6) cols(2)) byopts(row(2)) name(conditional, replace)  coeflabels(1.prog_bin_int#1.pop_bin_int=`" "Progressive policy"  "× populism""',labsize(small))  subtitle(, size(small)) grid(none)
   
resize conditional, xsize(18cm) ysize(11cm)

graph export "fig3.png", replace
graph save "fig3.gph", replace
			
********************************************************************************			
**# Calculating estimates in the text
********************************************************************************
	//point estimates for the text
	reg stdsup_pol i.prog_bin i.pop_bin   i.topic
	reg stdsup_pol i.prog_bin##i.pop_bin   i.topic
		
********************************************************************************			
**# 					APPENDIX 
********************************************************************************	

	
**# A15 - Descriptives overall
********************************************************************************
use  "VZ_experiment_data_sample.dta", clear	
	
asdoc tabstat sup_pol trust_gov lkh_voting lkh_protest female age migr lrscale educ income subj_income efficacy justification conservation   ///
if pop_bin != ., statistics(mean sd min max) fs(8) replace dec(2) save(A15) 				
	 	
	
**# A16 in the Appendix - CENSUS table 
********************************************************************************			
use  "VZ_experiment_data.dta", clear

//gender
fre  female

**# Bookmark #1
//Age 15-59
fre age if age > 15 & age <= 59  
disp 2115/2693 //78,5

//Age 60+
fre age if age >= 60 
disp 578/2693 //21,5

//migration 
fre v_31
	
	
**# A17 in the Appendix - Descriptives per experimental group
*******************************************************************************
use  "VZ_experiment_data_sample.dta", clear	

collect: table () (c_0002) , stat(mean female age migr lrscale educ income subj_income efficacy justification conservation ) nformat(%12.2f) 
collect export A17.docx, replace
	 
//anova for f-values
oneway female c_0002, tabulate
oneway age c_0002, tabulate
oneway migr c_0002, tabulate
oneway lrscale c_0002, tabulate
oneway educ c_0002, tabulate
oneway income c_0002, tabulate	
oneway subj_income c_0002, tabulate
oneway efficacy c_0002, tabulate
oneway justification c_0002, tabulate
oneway conservation c_0002, tabulate
	
	
**# A18 in the Appendix - Correlation Matrix	 
********************************************************************************
	
asdoc cor sup_pol trust_gov  female age  lrscale educ income subj_income efficacy justification conservation migr, fs(8) replace dec(2) save(A18) 
	

**# A19 - Mean Levels of Outcome Variables across Experimental Conditions
********************************************************************************
		
//Creating grouping variable
gen grouping = . 
replace grouping = 1 if pop_bin == 0 & prog_bin == 0
replace grouping = 2 if pop_bin == 1 & prog_bin == 0
replace grouping = 3 if pop_bin == 0 & prog_bin == 1
replace grouping = 4 if pop_bin == 1 & prog_bin == 1

label define grouping2 1 "Control" 2 "Populism" 3 "Progressiveness" 4 "Progressiveness + Populism"
lab val grouping grouping2

mean sup_pol, over(grouping)
est sto m1

mean trust_gov, over(grouping)
est sto m2	

//Creating coefplot
coefplot m1 m2, recast(scatter) color(grey%70) bfintensity(60) levels(95 83)   citop ciopts(lcolor(gs8 red%50)) ///	
	xtitle("Mean values") xlab(1(1)5, glcolor(gs15) glpattern(solid)) ylab(, noticks nogrid) ///
	graphregion(margin(vsmall)) ///
	note("Note: 83% (red) & 95% (black) CIs Shown", span size(vsmall)) /// 
	title("Support for policy and trust in government across experimental conditions") /// 
	coeflabels(c.sup_pol@1.grouping = "Control"  /// 
	c.sup_pol@2.grouping = "Populism"  /// 
	c.sup_pol@3.grouping = "Progressiveness"  /// 
	c.sup_pol@4.grouping = "Populism + Progressiveness"  /// 
	c.trust_gov@1.grouping = "Control"  /// 
	c.trust_gov@2.grouping = "Populism"  /// 
	c.trust_gov@3.grouping = "Progressiveness"  /// 
	c.trust_gov@4.grouping = "Populism + Progressiveness"  ) /// 
	headings(c.trust_gov@1.grouping = "{bf:DV: Trust in Government}" ///
	c.sup_pol@1.grouping = "{bf:DV: Support for Policy}") ///
	legend(off)
	
graph export "A19.png", replace
graph save "A19.gph", replace		
		
		
**# A20 in the Appendix - Fullmodel without controls
********************************************************************************
//DV: Policy Support
reg stdsup_pol i.prog_bin i.pop_bin  i.topic
est sto appendix_axx_m1

reg stdsup_pol i.prog_bin##i.pop_bin i.topic
est sto appendix_axx_m2

//DV: Trust in Government
reg stdtrust_gov i.prog_bin i.pop_bin  i.topic
est sto appendix_axx_m3

reg stdtrust_gov i.prog_bin##i.pop_bin i.topic
est sto appendix_axx_m4
	
esttab appendix_axx_m1 appendix_axx_m2 appendix_axx_m3 appendix_axx_m4  using "A20.rtf" , label b(%8.3f)  replace nogap onecell	 transform(ln*: exp(2*@) 2*exp(2*@)) 
	
	

**# A21 in the Appendix - Fullmodel without controls - Alternative Outcome variables
********************************************************************************
//DV: Lkh Protesting
reg stdlkh_protest i.prog_bin i.pop_bin  i.topic
est sto appendix_axx_m5

reg stdlkh_protest i.prog_bin##i.pop_bin i.topic
est sto appendix_axx_m6

//DV: Lkh Voting
reg stdlkh_voting i.prog_bin i.pop_bin  i.topic
est sto appendix_axx_m7

reg stdlkh_voting i.prog_bin##i.pop_bin i.topic
est sto appendix_axx_m8		
	 
esttab appendix_axx_m5 appendix_axx_m6 appendix_axx_m7 appendix_axx_m8 using "A21.rtf" , label b(%8.3f)  replace nogap onecell	 transform(ln*: exp(2*@) 2*exp(2*@)) 
				
		
**# A22 in the Appendix - Fullmodel without controls with Imputation 
********************************************************************************		
//Check missings
mi set wide
mi misstable summarize stdtrust_gov stdsup_pol prog_bin pop_bin topic migr female age lrscale educ income subj_income efficacy justification conservation

//including a missing category for missing in categorical variables
gen female_imput = female
recode female_imput (.=2)

gen migr_imput = migr
recode migr_imput (.=2)
	
//Imputation for metric variabels
mi register imputed educ age lrscale income subj_income efficacy justification conservation

//Imputation
mi impute mvn age educ lrscale income subj_income efficacy justification conservation  , add(10) rseed (53421)

//Regressions
//M1
eststo imput_1 :mi est, post : reg   stdsup_pol  i.prog_bin i.pop_bin i.topic i.migr_imput i.female_imput age lrscale educ income subj_income efficacy justification conservation 

//M2
eststo imput_2 :mi est, post : reg stdsup_pol  i.prog_bin##i.pop_bin i.topic i.migr_imput i.female_imput age lrscale educ income subj_income efficacy justification conservation 

//M3
eststo imput_3 :mi est, post : reg   stdtrust_gov  i.prog_bin i.pop_bin i.topic i.migr_imput i.female_imput age lrscale educ income subj_income efficacy justification conservation 

//M4
eststo imput_4 :mi est, post : reg stdtrust_gov  i.prog_bin##i.pop_bin i.topic i.migr_imput i.female_imput age lrscale educ income subj_income efficacy justification conservation 

esttab imput_1 imput_2 imput_3 imput_4   using "A22.rtf" , label b(%8.3f)  replace nogap onecell	 transform(ln*: exp(2*@) 2*exp(2*@)) 

	
**# A23 - Subgroup Analyses using Contrasting Groups
********************************************************************************		
clonevar prog_bin_int=prog_bin
clonevar pop_bin_int=pop_bin

reg stdsup_pol i.prog_bin i.pop_bin i.topic if income < 6
eststo Income_low
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if income < 6
eststo Income_low_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if income >= 6
eststo Income_low2
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if income >= 6
eststo Income_low_int2
reg stdsup_pol i.prog_bin i.pop_bin i.topic if subj_income >= 3
eststo Subj_income_low
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if subj_income >= 3
eststo Subj_income_low_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if subj_income >= 3
eststo Subj_income_low2
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if subj_income >= 3
eststo Subj_income_low_int2
reg stdsup_pol i.prog_bin i.pop_bin i.topic if female==0
eststo Male
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if female==0
eststo Male_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if female==1
eststo Male2
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if female==1
eststo Male_int2
reg stdsup_pol i.prog_bin i.pop_bin i.topic if educ==2 | educ==3 | educ==4
eststo Education_low
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if educ==2 | educ==3 | educ==4
eststo Education_low_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if educ==5 | educ==6 | educ==7
eststo Education_low2
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if educ==5 | educ==6 | educ==7
eststo Education_low_int2
reg stdsup_pol i.prog_bin i.pop_bin i.topic if lrscale > 5
eststo Ideology_right
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if lrscale > 5
eststo Ideology_right_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if lrscale <= 5
eststo Ideology_right2
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if lrscale <= 5
eststo Ideology_right_int2
reg stdsup_pol i.prog_bin i.pop_bin i.topic if tradition>4
eststo Traditionalism_high
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if tradition>4
eststo Traditionalism_high_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if tradition<=4
eststo Traditionalism_high2
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if tradition<=4
eststo Traditionalism_high_int2
reg stdsup_pol i.prog_bin i.pop_bin i.topic if age>48
eststo Age_above48
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if age>48
eststo Age_above48_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if age<=48
eststo Age_above482
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if age<=48
eststo Age_above48_int2
reg stdsup_pol i.prog_bin i.pop_bin i.topic if justification<3.17
eststo Systemjust_high
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if justification<3.17
eststo Systemjust_high_int
reg stdsup_pol i.prog_bin i.pop_bin i.topic if justification>=3.17
eststo Systemjust_high2
reg stdsup_pol i.prog_bin_int##i.pop_bin_int i.topic if justification>=3.17
eststo Systemjust_high_int2

coefplot Education_low Education_low_int Education_low2 Education_low_int2 ,  bylabel("1 Education") xline(0) mcolor(navy) ciopts(color(navy))  ///
|| Income_low Income_low_int Income_low2 Income_low_int2, bylabel("2 Income")  ///
|| Subj_income_low Subj_income_low_int  Subj_income_low2 Subj_income_low_int2, bylabel("3 Coping w. income")  ///
|| Male Male_int  Male2 Male_int2, bylabel("4 Male") ///
|| Age_above48 Age_above48_int Age_above482 Age_above48_int2, bylabel("5 Age") ///
|| Ideology_right Ideology_right_int Ideology_right2 Ideology_right_int2, bylabel("6 Ideology")  ///
|| Traditionalism_high Traditionalism_high_int  Traditionalism_high2 Traditionalism_high_int2, bylabel("7 Traditionalism")  ///
|| Systemjust_high Systemjust_high_int  Systemjust_high2 Systemjust_high_int2, bylabel("8 System justification") ///
 keep(1.pop_bin 1.prog_bin 1.prog_bin_int#1.pop_bin_int) xline(0) 	/*xscale(range(-0.5(0.2)0.5)) xlabel(-0.5(0.2)0.5)*/  headings(1.prog_bin=`" "{bf: A Policy progressiveness}" "(ref. no progressiveness)" "' 1.pop_bin=`" "{bf:B Populism}" "(ref. no populism mentioned)" "' 2.topic= `" "{bf: C Policy Areas}" "(ref. gender equity)" "' 1.prog_bin_int#1.pop_bin_int=`" "{bf: C Interaction}"  "'   )    legend(position(6) cols(2)) byopts(row(2) /*compact*/) name(conditional, replace)  coeflabels(1.prog_bin_int#1.pop_bin_int="Progressive policy × populism",labsize(small))  subtitle(, size(small))
  
resize conditional, xsize(18cm) ysize(12cm)

graph export "A23.png", replace
graph save "A23.gph", replace


**# A24 - Main models by policy areas
********************************************************************************			

estimates clear
foreach var of varlist  stdsup_pol stdtrust_gov {
	reg `var'  i.prog_bin  i.pop_bin if topic == 1
	est sto all_`var'_t0gender
	
	reg `var' i.prog_bin_int##i.pop_bin_int if topic == 1
	est sto all_`var'_t1gender
	
	***
	reg `var'  i.prog_bin  i.pop_bin if topic == 2
	est sto all_`var'_t0migr
	
	reg `var' i.prog_bin_int##i.pop_bin_int if topic == 2
	est sto all_`var'_t1migr			
	
	***
	reg `var'  i.prog_bin  i.pop_bin if topic == 3
	est sto all_`var'_t0clima
	
	reg `var' i.prog_bin_int##i.pop_bin_int if topic == 3
	est sto all_`var'_t1clima						
}

coefplot all_stdsup_pol_t0gender all_stdtrust_gov_t0gender   all_stdsup_pol_t1gender  all_stdtrust_gov_t1gender  ,  bylabel("1 Gender equity") xline(0) mcolor(navy) ciopts(color(navy)) ///
|| all_stdsup_pol_t0migr all_stdtrust_gov_t0migr   all_stdsup_pol_t1migr  all_stdtrust_gov_t1migr,  bylabel("1 Integration")  ///
|| all_stdsup_pol_t0clima all_stdtrust_gov_t0clima   all_stdsup_pol_t1clima  all_stdtrust_gov_t1clima,  bylabel("1 Climate change") ///
	 keep(1.pop_bin 1.prog_bin 1.prog_bin_int#1.pop_bin_int) xline(0) 	/*xscale(range(-0.5(0.2)0.5)) xlabel(-0.5(0.2)0.5)*/  headings(1.prog_bin=`" "{bf: A Policy progressiveness}" "(ref. no progressiveness)" "' 1.pop_bin=`" "{bf:B Populism}" "(ref. no populism mentioned)" "' 2.topic= `" "{bf: C Policy Areas}" "(ref. gender equity)" "' 1.prog_bin_int#1.pop_bin_int=`" "{bf: C Interaction}"  "'   )    legend(position(6) cols(2)) byopts(row(1) /*compact*/) name(conditional, replace)  coeflabels(1.prog_bin_int#1.pop_bin_int="Progressive policy × populism",labsize(small))  subtitle(, size(small))

resize conditional, xsize(18cm) ysize(11cm)

graph export "A24.png", replace
graph save "A24.gph", replace
			
		
**# A25 - Conditional treatment effects
********************************************************************************				
estimates clear
reg stdtrust_gov i.prog_bin i.pop_bin i.topic
eststo base
reg stdtrust_gov i.prog_bin_int##i.pop_bin_int i.topic
eststo base_int
reg stdtrust_gov i.prog_bin i.pop_bin i.topic if income < 6
eststo Income_low
reg stdtrust_gov i.prog_bin_int##i.pop_bin_int i.topic if income < 6
eststo Income_low_int
reg stdtrust_gov i.prog_bin i.pop_bin i.topic if subj_income < 3
eststo Subj_income_low
reg stdtrust_gov i.prog_bin_int##i.pop_bin_int i.topic if subj_income < 3
eststo Subj_income_low_int
reg stdtrust_gov i.prog_bin i.pop_bin i.topic if female==0
eststo Male
reg stdtrust_gov i.prog_bin_int##i.pop_bin_int i.topic if female==0
eststo Male_int
reg stdtrust_gov i.prog_bin i.pop_bin i.topic if educ==2 | educ==3 | educ==4
eststo Education_low
reg stdtrust_gov i.prog_bin_int##i.pop_bin_int i.topic if educ==2 | educ==3 | educ==4
eststo Education_low_int
reg stdtrust_gov i.prog_bin i.pop_bin i.topic if lrscale > 5
eststo Ideology_right
reg stdtrust_gov i.prog_bin_int##i.pop_bin_int i.topic if lrscale > 5
eststo Ideology_right_int
reg stdtrust_gov i.prog_bin i.pop_bin i.topic if tradition>4
eststo Traditionalism_high
reg stdtrust_gov i.prog_bin_int##i.pop_bin_int i.topic if tradition>4
eststo Traditionalism_high_int
reg stdtrust_gov i.prog_bin i.pop_bin i.topic if age>48
eststo Age_above48
reg stdtrust_gov i.prog_bin_int##i.pop_bin_int i.topic if age>48
eststo Age_above48_int
reg stdtrust_gov i.prog_bin i.pop_bin i.topic if justification<3.17
eststo Systemjust_high
reg stdtrust_gov i.prog_bin_int##i.pop_bin_int i.topic if justification<3.17
eststo Systemjust_high_int

coefplot Education_low Education_low_int base base_int,  bylabel(1 Low education) xline(0) mcolor(navy) ciopts(color(navy))  ///
	|| Income_low Income_low_int base base_int, bylabel(2 Low income)  ///
	|| Subj_income_low Subj_income_low_int base base_int, bylabel(3 Low coping w. income)  ///
	|| Male Male_int base base_int, bylabel(4 Male) ///
	|| Age_above48 Age_above48_int base base_int, bylabel(5 Age (> median(48))) ///
	|| Ideology_right Ideology_right_int base base_int, bylabel(6 Ideology - right)  ///
	|| Traditionalism_high Traditionalism_high_int base base_int, bylabel(7 Traditionalism - high)  ///
	|| Systemjust_high Systemjust_high_int base base_int, bylabel(8 System Just. - high) ///
	 keep(1.pop_bin 1.prog_bin 1.prog_bin_int#1.pop_bin_int) xline(0) 	xscale(range(-0.65(0.2)0.2)) xlabel(-0.6(0.2)0.2)  headings(1.prog_bin=`" "{bf: A Policy progressiveness}" "(ref. no progressiveness)" "' 1.pop_bin=`" "{bf:B Populism}" "(ref. no populism mentioned)" "' 2.topic= `" "{bf: C Policy Areas}" "(ref. gender equity)" "' 1.prog_bin_int#1.pop_bin_int=`" "{bf: C Interaction}"  "'   )     legend(position(6) cols(2)) byopts(row(2) /*compact*/) name(conditional, replace)  coeflabels(1.prog_bin_int#1.pop_bin_int="Progressive policy × populism",labsize(small))  subtitle(, size(small)) grid(none)
	  
resize conditional, xsize(18cm) ysize(12cm)

graph export "A25.png", replace
graph save "A25.gph", replace
	
	
**# A26 Results of all experimental groups
********************************************************************************			
use  "VZ_experiment_data.dta", clear
	
//Drop cases with low times on vignettes
gen marker = 0 
replace marker = 1 if (time_v > 0 & time_v < 0.25 & !inlist(c_0002,1))

//Drop cases under 2 minutes overallduration
cap drop marker2
gen marker2 = 0 
replace marker2 = 1 if duration >= 0 & duration <= 2 

//Missing on Outcome variales
mark nonmiss
markout nonmiss sup_pol trust_gov 

//Check exluded cases
gen exclusion = 0 
replace exclusion = 1 if nonmiss == 0 | nuller > 15 | marker2 == 1 | marker == 1

drop if nuller > 15 	//70 due to speeder
drop if nonmiss == 0 	//3 due to missings on outcome
drop if marker2 == 1	//6 due to too overall durations
drop if marker == 1 	//233 due to short time on vignette 

//Standardizing variables
foreach var of varlist  support_gov3 support_gov4 sup_pol trust_gov lkh_voting lkh_protest lrscale {
egen std`var'=std(`var')  
}						
				
//Dichtomizing
recode populism 1=0 2=. 3/4=1, gen(pop_bin)		//3+4 = 1
recode progressive 1=0 2/3=1	, gen(prog_bin)			//2+3 = 1
				
lab define prog_bin 0 "No progressive policy" 1 "Progressive policy"
lab val prog_bin prog_bin
	
lab define pop_bin 0 "No populism" 1 "Populism"
lab val pop_bin pop_bin 				
				
clonevar progressive_int=progressive
clonevar populism_int=populism
clonevar topic_int=topic

estimates clear
foreach var of varlist  stdsup_pol stdtrust_gov {
	reg `var'  i.progressive  i.populism  i.topic , coeflegend
	est sto alle_`var'_t0
	
	reg `var' i.prog_bin##i.pop_bin i.topic_int, coeflegend
	est sto all_`var'_t1			
}

coefplot  alle_*_t0 all_*_t1,  bylabel(1 All topics) xline(0) mcolor(navy) ciopts(color(navy)) grid(none)  ///
	  keep(*populism *progressive 1.prog_bin#1.pop_bin *topic) xline(0)	xscale(range(-0.6(0.2)0.3)) xlabel(-0.6(0.2)0.2)  headings(2.progressive=`" "{bf: A Policy progressiveness}" "(ref. no progressiveness)" "' 2.populism=`" "{bf:B Populism}" "(ref. no populism mentioned)" "' 2.topic= `" "{bf: C Policy Areas}" "(ref. gender equity)" "' 1.prog_bin#1.pop_bin=`" "{bf: D Interaction}"  "'   )   coeflabels(1.prog_bin_int#1.pop_bin_int="Progressive policy × populism",labsize(small))  subtitle(, size(small))  p1(label(Support for policy)) p2(label(Trust in government)) legend(position(6) cols(2))  byopts(row(1)) name(ate, replace) 
	
resize ate, xsize(15cm) ysize(12cm)		

graph export "A26.png", replace
graph save "A26.gph", replace		
	
**# A27 - Moderation Framework
********************************************************************************			
use  "VZ_experiment_data_sample.dta", clear

clonevar prog_bin_int=prog_bin
clonevar pop_bin_int=pop_bin
clonevar topic_int=topic
	
//DV: Satisfaction with government
//Metric moderators
foreach var of varlist 	age subj_income tradition justification lrscale income educ {
	rename `var' moderator

	reg stdsup_pol i.prog_bin##c.moderator i.topic 
	est sto pol1_`var'

	reg stdsup_pol i.pop_bin##c.moderator i.topic 
	est sto pol2_`var'
		
	reg stdsup_pol i.prog_bin##i.pop_bin##c.moderator i.topic , coeflegend
	est sto pol3_`var'
	
	rename moderator `var'
}

//Dummy moderator
foreach var of varlist female {
	rename `var' moderator

	reg stdsup_pol i.prog_bin##i.moderator i.topic 
	est sto pol1_`var'

	reg stdsup_pol i.pop_bin##i.moderator i.topic 
	est sto pol2_`var'
		
	reg stdsup_pol i.prog_bin##i.pop_bin##i.moderator i.topic , coeflegend
	est sto pol3_`var'
	
	rename moderator `var'
			
}
	
esttab pol1_educ pol2_educ pol3_educ ///
	pol1_subj_income pol2_subj_income pol3_subj_income ///
	pol1_income pol2_income pol3_income ///
using "A27_part1.rtf" , label b(%8.3f)  replace nogap onecell	 transform(ln*: exp(2*@) 2*exp(2*@)) keep(1.pop_bin#c.moderator 1.prog_bin#c.moderator 1.prog_bin#1.pop_bin#c.moderator)

esttab pol1_female pol2_female pol3_female ///
using "A27_part2.rtf" , label b(%8.3f)  replace nogap onecell	 transform(ln*: exp(2*@) 2*exp(2*@)) keep(1.pop_bin#1.moderator 1.prog_bin#1.moderator 1.prog_bin#1.pop_bin#1.moderator)
	
esttab pol1_age pol2_age pol3_age ///
	pol1_lrscale pol2_lrscale pol3_lrscale ///
	pol1_tradition pol2_tradition pol3_tradition ///
	pol1_justification pol2_justification pol3_justification ///
using "A27_part3.rtf" , label b(%8.3f)  replace nogap onecell	 transform(ln*: exp(2*@) 2*exp(2*@)) keep(1.pop_bin#c.moderator 1.prog_bin#c.moderator 1.prog_bin#1.pop_bin#c.moderator)
	

***********************
//DV: Trust in government
//Metric moderators
foreach var of varlist 	age subj_income tradition justification lrscale income educ {
	rename `var' moderator

	reg stdtrust_gov i.prog_bin##c.moderator i.topic 
	est sto trust1_`var'

	reg stdtrust_gov i.pop_bin##c.moderator i.topic 
	est sto trust2_`var'
		
	reg stdtrust_gov i.prog_bin##i.pop_bin##c.moderator i.topic , coeflegend
	est sto trust3_`var'
	
	rename moderator `var'
}

//Dummy moderators
foreach var of varlist female {
	rename `var' moderator

	reg stdtrust_gov i.prog_bin##i.moderator i.topic 
	est sto trust1_`var'

	reg stdtrust_gov i.pop_bin##i.moderator i.topic 
	est sto trust2_`var'
		
	reg stdtrust_gov i.prog_bin##i.pop_bin##i.moderator i.topic , coeflegend
	est sto trust3_`var'
	
	rename moderator `var'	
}
	
esttab trust1_educ trust2_educ trust3_educ ///
	trust1_subj_income trust2_subj_income trust3_subj_income ///
	trust1_income trust2_income trust3_income ///
using "A27_part4.rtf" , label b(%8.3f)  replace nogap onecell	 transform(ln*: exp(2*@) 2*exp(2*@)) keep(1.pop_bin#c.moderator 1.prog_bin#c.moderator 1.prog_bin#1.pop_bin#c.moderator)

esttab trust1_female trust2_female trust3_female ///
using "A27_part5.rtf" , label b(%8.3f)  replace nogap onecell	 transform(ln*: exp(2*@) 2*exp(2*@)) keep(1.pop_bin#1.moderator 1.prog_bin#1.moderator 1.prog_bin#1.pop_bin#1.moderator)
	
esttab trust1_age trust2_age trust3_age ///
	trust1_lrscale trust2_lrscale trust3_lrscale ///
	trust1_tradition trust2_tradition trust3_tradition ///
	trust1_justification trust2_justification trust3_justification ///
using "A27_part6.rtf" , label b(%8.3f)  replace nogap onecell	 transform(ln*: exp(2*@) 2*exp(2*@)) keep(1.pop_bin#c.moderator 1.prog_bin#c.moderator 1.prog_bin#1.pop_bin#c.moderator)
	
				

